SSTACK SEGMENT
    DB 100 DUP("?")

SSTACK ENDS

DSEG SEGMENT
ADDR DW NUMBER
NUMBER DW "Y"
COUNT DW "?"
DSEG ENDS

CSEG SEGMENT
MAIN PROC FAR
     ASSUME CS:CSEG DS:DSEG SS:SSTACK  
START: PUSH DS 
       SUB  AX,AX
       PUSH AX
       MOV AX,DSEG
       MOV DS,AX
       MOV CX,0
       MOV BX,ADDR
       MOV AX,[BX]

REPEAT: TEST AX,0FFFFH
        JZ EXIT
        JNS SHIFT
        INC CX

SHIFT: SHL AX,1
       JMP REPEAT

EXIT:  MOV COUNT,CX
       RET

 
MAIN ENDP
    ;  MOV AX,4C00H
    ;  INT 21H

CSEG ENDS

END START






    